
//旅游景区管理 -- 旅游景区详情
var starttime = ""; //开始时间
var endtime = ""; //结束时间
var pagesize = 10;
var pageindex = 1;
var sortfild = ""; //排序的关键字
var sortway = ""; //排序：升序、降序
var startTime = ""; //开放时间 开始（基本信息）
var endTime = ""; //开发时间 结束（基本信息）
var uid_department = getCookie("admin_role");
var uid_encryptid = getCookie("uid_encryptid");
var current_business_encryptId = getCookie("business_encryptId");
var current_sceinc_encryptId = getCookie("shop_encryptId");
var editIndex,layedit;
var ttname = "";
var themelist="",crowdlist="",palytypelist = "";  //游玩类型加密id
$(function() {

    //表格的文字说明
    $(document).on("mouseover",".show_tabletitel_tips",function(){
        if($(this).attr("text")!=""&&$(this).attr("text")!=null){
            layer.tips($(this).attr("text"), $(this), {
                tips: [1, '#3595CC'],
                time: 0
            })
        }
    });
    $(document).on("mouseout",".show_tabletitel_tips",function(){
        layer.closeAll('tips');
    });

	layui.use(['form', 'layer', 'layedit','laydate'], function() {
		$ = layui.jquery;
		layedit = layui.layedit,
		laydate = layui.laydate;

        //时间范围
        laydate.render({
            elem: '#kftime',
            type: 'time',
            range: true,
        });

		//创建一个编辑器
		editIndex = layedit.build('business_intr'); //id值
		
		// //给文本框赋值
		// var str = "<p>小狐狸</p>"
		// layedit.setContent(editIndex, str)
	});

	/*基本信息修改*/
	$(".client_int").bind('input propertychange,select change', function() {
		$(".client_tool").css("display", "none");
		$(this).siblings(".client_tool").css("display", "inline-block");
	});
	$(".cancel").click(function() {
		$(this).parent(".client_tool").css("display", "none");
	});


	//悬浮显示 当宽度小于 文字宽度时，则鼠标移到该内容时，悬浮显示，将文字全部显示出来
	$(document).on("mouseover", ".show_tips", function() {
		if($(this).width() > $(this).parent().width()) {
			layer.tips($(this).html(), $(this), {
				tips: [1, '#3595CC'],
				time: 0
			})
		}
	});
	$(document).on("mouseout", ".show_tips", function() {
		layer.closeAll('tips');
	});

	//全选中或全不选
	$("#checkAll,#entertain_checkAll").click(function() {
		if($(this).is(':checked')) {
			$(".checkbox").prop("checked", true);
		} else {
			$(".checkbox").prop("checked", false);
		}
	})

	/*切换搜索条件*/
	$("#conditional_search").find("li").click(function() {
		$("#search_name").text($(this).text());
		$(this).find("a").attr('value');
		$("#search_name").attr('value', $(this).find("a").attr('name'));
	});

    //获取商家基本信息
    getbusinessinfo();

    getData();

})

function getData(){
	/************基本信息***************/
	$("#basic_info").click(function(){
		$(".bottom_page").hide();
		//调用方法
        getbusinessinfo();
	});
	
	/************景区图集***************/
	$("#scenic_atlas").click(function(){
		$(".bottom_page").hide();
		//调用方法
        myatlasinfo();
	});
	
	/************娱乐项目***************/
	$("#enter_show").click(function(){
		$(".bottom_page").show();
        ttname = "景区娱乐项目";
		$("#first_button").click();
	});
	
	/************评论信息***************/
	$("#comm_info").click(function(){
		$(".bottom_page").show();
        ttname = "景区评论信息";
		$("#first_button").click();
	});
	
	/************收藏信息***************/
	$("#collect_info").click(function(){
		$(".bottom_page").show();
        ttname = "景区收藏信息";
		$("#first_button").click();
	});

    /************定制信息***************/
    $("#customize_info").click(function(){
        $(".bottom_page").show();
        ttname = "景区定制信息";
        $("#first_button").click();
    });
}

/***********************************-------基本信息---------************************************************/

//商家基本信息
function getbusinessinfo() {
    var layLoad=layer.load(2);
    $.post('/scebusinesinfo/getfarminfoOne', {
        "business_encryptId": current_business_encryptId,
        "sceinc_encryptId": current_sceinc_encryptId
    }, function (value) {
        layer.close(layLoad);
        if (value.status == 0 && value.msg == "ok") {
            var list = value.list;
            if(list.length>0){
                $("#client_name").text(list[0].tel+"商家详情");
                $("#cbusiness_name").text((list[0].business_name == null ?"":list[0].business_name));
                $("#cscenictypeName").text((list[0].scenictypeName == null ?"":list[0].scenictypeName));
                $("#ctel").attr("value",(list[0].tel == null ?"":list[0].tel));
                $("#cbusinessLegal").text((list[0].business_Legal == null ?"":list[0].business_Legal));
                $("#CompanyName").text((list[0].CompanyName == null ?"":list[0].CompanyName));
                $("#cbusiness_create").text((list[0].business_create == null ?"":list[0].business_create));
                $("#clicense").attr("value",(list[0].business_license == null ?"":list[0].business_license));
                $("#Credit").text((list[0].business_Credit == null ?"":list[0].business_Credit));
                // $("#ccity").attr("value",(list[0].city+list[0].district));
                $("#ccity").attr("value",(list[0].city));
                $("#cdistrict").attr("value",(list[0].district));

                $("#kftime").attr("value",list[0].develop_time); //开放时间
                $("#cticket").attr("value",(list[0].scenic_ticket == null ?"":list[0].scenic_ticket)); //门票
                $("#caddress").attr("value",(list[0].scenic_address == null ?"":list[0].scenic_address)); //住所
                $("#cviews").text((list[0].scenic_views == null ?"":list[0].scenic_views+"次"));
                $("#cscore").text((list[0].scenic_score == null ?"":list[0].scenic_score+"分"));
                $("#cscenic_season").find("option[value='"+list[0].scenic_season+"']").attr("selected",true);
                $("#Credit").text((list[0].business_Credit == null ?"":list[0].business_Credit));

                $("#cfarm_status").find("option[value='"+list[0].farm_status+"']").attr("selected",true);
                $("#ccreatetime").text((list[0].createtime == null ?"":list[0].createtime));//注册时间
                $("#cscenic_grade").find("option[value='"+list[0].scenic_grade+"']").attr("selected",true); //等级

                $("#cscenic_bus_route").val((list[0].scenic_bus_route == null ?"":list[0].scenic_bus_route));
                $("#cscenic_self_route").val((list[0].scenic_self_route == null ?"":list[0].scenic_self_route));

                themelist = list[0].theme_encryptId; //主题游
                palytypelist = list[0].palyType_encryptId; //游玩类型
                crowdlist = list[0].crowd_encryptId; //适合人群

                layui.use(['form', 'layer', 'layedit'], function() {
                    $ = layui.jquery;
                    layedit = layui.layedit;

                    //创建一个编辑器
                    editIndex = layedit.build('business_intr'); //id值

                    //给文本框赋值
                    var str = "<p>"+list[0].scenic_Intr_info+"</p>"
                    layedit.setContent(editIndex, str);
                });

                //加载主题游
                getThemelist();
                //游玩类型
                getSecPlayTypelist();
                //适合人群
                getAllCrowd();

            }

        } else {
            if (value.msg == null || value.msg == "") {
                layer.alert("接口出现错误！", {icon: 2})
            } else {
                layer.alert(value.msg, {icon: 2})
            }
        }
    })
}

//显示营业执照
function showVoucher(){
    var url = $("#clicense").attr("value");
    if(url!="" && url != undefined){
        var cancel = "<a onclick='mclose()' class=\"sure_btn1\">关闭</a>";
        prompt = "<img style='max-width: 80%;' src='"+url+"'>";
        var html = "<div class='linepopup1'>" + prompt + "</div>" + cancel;
        parent.ComOpenWin(1, "营业执照", "480px", 'auto', html, 1);
    }
}


//获取全部的主题游信息列表
function getThemelist() {
    $("#themeRemarks").html("");
    $.post('/SceThemeType/getAllSceThemetype', {}, function (data) {
        if (data.status == 0 && data.msg == 'ok') {
            var list = data.list;
            var str = "";
            var themeRemarkslist = themelist.split(",");
            if(list.length>0){
                for(var i=0;i<list.length;i++){
                    if ($.inArray(list[i].encryptId, themeRemarkslist) != -1) {
                        str += "<li><a href=\"javascript:void(0)\" onclick='modifyRemarks(this)' name=\"" +list[i].themeId+ "\"  value=\"" +list[i].encryptId+ "\" class=\"xinjian_btn remarks_a\">" + list[i].title + "</a></li>";
                    } else {
                        str += "<li><a href=\"javascript:void(0)\" onclick='modifyRemarks(this)' name=\"" +list[i].themeId+ "\"  value=\"" +list[i].encryptId+ "\" class=\"xinjian_btn_white remarks_a\">" + list[i].title + "</a></li>";
                    }
                }
                $("#themeRemarks").html(str);
            }
        } else {
            if(data.msg==null||data.msg==""){
                layer.alert("接口出现错误！", {icon: 2})
            }else{
                layer.alert(data.msg, {icon: 2})
            }
        }
    })

}

//获取景区游玩类型
function getSecPlayTypelist() {
    $("#playRemarks").html("");
    $.post('/ScePlayType/getAllScePlaytype', {}, function (data) {
        if (data.status == 0 && data.msg == 'ok') {
            var list = data.list;
            var str = "";
            var playRemarkslist = palytypelist.split(",");
            if(list.length>0){
                for(var i=0;i<list.length;i++){
                    if ($.inArray(list[i].encryptId, playRemarkslist) != -1) {
                        str += "<li><a href=\"javascript:void(0)\" onclick='modifyRemarks(this)' name=\"" +list[i].sceplayId+ "\"  value=\"" +list[i].encryptId+ "\" class=\"xinjian_btn remarks_a\">" + list[i].title + "</a></li>";
                    } else {
                        str += "<li><a href=\"javascript:void(0)\" onclick='modifyRemarks(this)' name=\"" +list[i].sceplayId+ "\"  value=\"" +list[i].encryptId+ "\" class=\"xinjian_btn_white remarks_a\">" + list[i].title + "</a></li>";
                    }
                }
                $("#playRemarks").html(str);
            }
        } else {
            if(data.msg==null||data.msg==""){
                layer.alert("接口出现错误！", {icon: 2})
            }else{
                layer.alert(data.msg, {icon: 2})
            }
        }
    })
}

//适合人群
function getAllCrowd() {
    $("#crowdRemarks").html("");
    $.post('/Crowd/getAllCrowd', {}, function (data) {
        if (data.status == 0 && data.msg == 'ok') {
            var list = data.list;
            var str = "";
            var themeRemarkslist = crowdlist.split(",");
            if(list.length>0){
                for(var i=0;i<list.length;i++){
                    if ($.inArray(list[i].encryptId, themeRemarkslist) != -1) {
                        str += "<li><a href=\"javascript:void(0)\" onclick='modifyRemarks(this)' name=\"" +list[i].CrowdId+ "\"  value=\"" +list[i].encryptId+ "\" class=\"xinjian_btn remarks_a\">" + list[i].title + "</a></li>";
                    } else {
                        str += "<li><a href=\"javascript:void(0)\" onclick='modifyRemarks(this)' name=\"" +list[i].CrowdId+ "\"  value=\"" +list[i].encryptId+ "\" class=\"xinjian_btn_white remarks_a\">" + list[i].title + "</a></li>";
                    }
                }
                $("#crowdRemarks").html(str);
            }
        } else {
            if(data.msg==null||data.msg==""){
                layer.alert("接口出现错误！", {icon: 2})
            }else{
                layer.alert(data.msg, {icon: 2})
            }
        }
    })
}

//修改备注(主题游，游玩类型，适合人群)
function modifyRemarks(obj) {
    //取消
    if ($(obj).hasClass("xinjian_btn")) {
        $(obj).addClass("xinjian_btn_white").removeClass("xinjian_btn");
    }
    //添加
    else {
        $(obj).addClass("xinjian_btn").removeClass("xinjian_btn_white");
    }

    //主题游备注
    var themeRemarks = "",theme_encryptId = "";
    var ThemeRemarkslist = $(".themeRemarks").find(".xinjian_btn");
    for (var i = 0; i < ThemeRemarkslist.length; i++) {
        if (i == 0) {
            theme_encryptId += $(ThemeRemarkslist[i]).attr('value');
            themeRemarks += $(ThemeRemarkslist[i]).text();
        } else {
            theme_encryptId += "," + $(ThemeRemarkslist[i]).attr('value');
            themeRemarks += "," + $(ThemeRemarkslist[i]).text();
        }
    }

    //游玩类型备注
    var playRemarks = "",play_encryptId="";
    var playRemarkslist = $(".playRemarks").find(".xinjian_btn");
    for (var i = 0; i < playRemarkslist.length; i++) {
        if (i == 0) {
            play_encryptId += $(playRemarkslist[i]).attr('value');
            playRemarks += $(playRemarkslist[i]).text();
        } else {
            play_encryptId += "," + $(playRemarkslist[i]).attr('value');
            playRemarks += "," + $(playRemarkslist[i]).text();
        }
    }

    //适合人群类型备注
    var crowdRemarks = "",crowd_encryptId="";
    var crowdRemarkslist = $(".crowdRemarks").find(".xinjian_btn");
    for (var i = 0; i < crowdRemarkslist.length; i++) {
        if (i == 0) {
            crowd_encryptId += $(crowdRemarkslist[i]).attr('value');
            crowdRemarks += $(crowdRemarkslist[i]).text();
        } else {
            crowd_encryptId += "," + $(crowdRemarkslist[i]).attr('value');
            crowdRemarks += "," + $(crowdRemarkslist[i]).text();
        }
    }


    //修改
    $.post('/scebusinesinfo/modifysceincRemarks', {
        "sceinc_encryptId":current_sceinc_encryptId,
        "themeRemarks":themeRemarks,
        "theme_encryptId":theme_encryptId,
        "playRemarks":playRemarks,
        "play_encryptId": play_encryptId,
        "crowdRemarks": crowdRemarks,
        "crowd_encryptId": crowd_encryptId
    }, function (value) {
        if (value.status == 0 && value.msg == 'ok') {

        } else {
            //取消
            if ($(obj).hasClass("xinjian_btn")) {
                $(obj).addClass("xinjian_btn_white").removeClass("xinjian_btn");
            } else {
                //添加
                $(obj).addClass("xinjian_btn").removeClass("xinjian_btn_white");
            }
            if (value.msg == null || value.msg == "") {
                layer.alert("接口出现错误！", {icon: 2})
            } else {
                layer.alert(value.msg, {icon: 2})
            }
        }
    })

}

//更改商家基本信息
function updateinfo(updatefiled,updateid,type) {
    var updateval = "";
    if(type == 1){
        //文本框
        updateval = $("#"+updateid+"").val().trim();
    }else if(type == 2){
        //select选择器
        updateval = $("#"+updateid+" option:selected").attr("value"); //获取选中的项
    }

    var layLoad=layer.load(2);
    $.post('/scebusinesinfo/updateSceincinfo', {
        "business_encryptId": current_business_encryptId,
        "scenic_encryptId": current_sceinc_encryptId,
        "updatefiled":updatefiled,
        "updateval":updateval
    }, function (value) {
        layer.close(layLoad);
        if (value.status == 0 && value.msg == "ok") {

            layer.msg("修改成功！", {icon: 1,time:2000});

        } else {
            if (value.msg == null || value.msg == "") {
                layer.alert("接口出现错误！", {icon: 2})
            } else {
                layer.alert(value.msg, {icon: 2})
            }
        }
    })
}

//基本信息--立即提交
function savecalldetail(updatefiled) {

    var bussines_intr = layedit.getContent(editIndex);

    var layLoad=layer.load(2);
    $.post('/scebusinesinfo/updateSceincinfo', {
        "business_encryptId": current_business_encryptId,
        "scenic_encryptId": current_sceinc_encryptId,
        "updatefiled":updatefiled,
        "updateval":bussines_intr
    }, function (value) {
        layer.close(layLoad);
        if (value.status == 0 && value.msg == "ok") {

            layer.msg("修改成功！", {icon: 1,time:2000});

        } else {
            if (value.msg == null || value.msg == "") {
                layer.alert("接口出现错误！", {icon: 2})
            } else {
                layer.alert(value.msg, {icon: 2})
            }
        }
    })
}


/***********************************-------娱乐图集---------************************************************/
var layuiupload = null;
$(function () {

    //景区图片上传
    //文件上传
    layui.use('upload', function () {
        var upload = layui.upload;
        layuiupload = upload;
        var ii = null;
        //执行实例
    });
})

//动态绑定上传事件
function picupload(id, pic) {
    var ii = null;
    layuiupload.render({
        elem: id //绑定元素
        , url: '/xw/imgfile' //上传接口 (调用原本可以上传的url，并没有将数据存入数据库中)
        , accept: 'file'
        , before: function (obj) { //obj参数包含的信息，跟 choose回调完全一致，可参见上文。
            ii = layer.load(2); //上传loading
        }
        , done: function (res) {
            // alert(res + "动态");
            var item = $(this.item);
            var itemurl = item.attr("id");
            layer.close(ii);
            //上传完毕回调
            if (res.status == 0) {
                $("."+itemurl).val(res.fileurl);
            } else {
                layer.alert("上传文件失败！", {icon: 1})
            }
        }
        , error: function () {
            //请求异常回调
            layer.close(ii);
            layer.alert("上传文件发生异常！", {icon: 1})
        }
    });
}

//数据列表
function myatlasinfo() {
    $("#my_atlasinfo_list").html("");
    //先查询
    $.post('/sceAtlasinfo/getscenicaltlasinfowin', {'scenic_encryptId': current_sceinc_encryptId}, function (value) {
        if (value.status == 0 && value.msg == "ok") {
            var list = value.list;
            var str = "";
            if(list.length>0){
                for(var i=0;i<list.length;i++){
                    str += "<li class='item'>";
                    str += "<div class='portfoliobox'>";
                    // str += "<span class='layui-btn layui-btn-xs demo-reload' style='float:left;line-height: 25px;' onclick=\"question_edit('"+list[i].id+"')\">编辑</span>";
                    // str += "<input class='checkbox' type='checkbox' value='"+list[i].id+"'>";
                    str += "<div class='picbox'>";
                    str += "<a href='javascript:void(0);' data-lightbox='gallery' data-title='图集"+Number(i+1)+"'>";
                    str += "<img src='"+list[i].imgurl+"?x-oss-process=style/tuImgStyle' layer-src='"+list[i].imgurl+"'>";
                    str += "</a>";
                    str += "</div>";
                    str += "<div class='textbox'>图集"+Number(i+1)+"</div>";
                    str += "</div>";
                    str += "</li>";
                }
                $("#my_atlasinfo_list").html(str);
            }else {
                layer.msg("暂无数据！",{icon:0,time:2000});
            }
        } else {
            if(value=="" || value==null){
                layer.alert("接口出现错误！", {icon: 2});
            }else {
                layer.alert(value.msg, {icon: 2});
            }
        }
    });
}


//点击图片，进行放大
$(document).on("click", "#my_atlasinfo_list .picbox", function () {
    seePicture($(this).find("img").attr("layer-src"));
})

//图片放大
function seePicture(url) {
    var url = url.split(",");
    var photos = new Array();
    for (var i = 0; i < url.length; i++) {
        photos.push({"alt": "图片" + (1 + i), "pid": "", "src": url[i], "thumb": ""});
    }
    var json = {"title": "素材", "id": "", "start": 0, "data": photos};
    layer.photos({
        photos: json,
        area: "[auto,auto]",
        skin: "layer_photos"
        , shift: 5 //0-6的选择，指定弹出图片动画类型，默认随机（请注意，3.0之前的版本用shift参数）
    });
}

//添加
function question_add() {
    var imgurlArry = new Array();
    $("#faceAndVideoBody").html("");

    //先查询
    $.post('/sceAtlasinfo/getscenicaltlasinfowin', {'scenic_encryptId': current_sceinc_encryptId}, function (value) {
        if (value.status == 0 && value.msg == "ok") {
            var list = value.list;
            if (list.length == 0) {
                imgurlArry = [];
                console.log("原数组没有数据："+imgurlArry.length+","+imgurlArry);
            }else {
                imgurlArry = list;
                console.log("原数组数据："+imgurlArry.length+","+imgurlArry);
            }
        } else {
            if(value=="" || value==null){
                layer.alert("接口出现错误！", {icon: 2});
            }else {
                layer.alert(value.msg, {icon: 2});
            }
        }
        ComOpenWin(1,"景区图集", "auto","auto", $('#newAtasinfobuildwin'), 1);
        newVideoInfo(1,imgurlArry); //追加样式
    });

}

//保存——提交请求
function addatasinfoSave() {
    var imglinkArry = new Array(); //小类APP广告1,或者2
    var data={};

    var bodylength=$("#faceAndVideoBody tr").length
    for (var k=1;k<=bodylength;k++){
        var sx = ".advertising_cover"+k
        $(""+sx+" input[type='text']").each(function (i,item) {
            if(i==0){
                data["id"]=$(this).attr("value");
            }else if(i==1){
                data["business_encryptId"]=$(this).attr("value");
            }else if (i == 2){
                data["scenic_encryptId"]=$(this).attr("value");
            }else if(i==3){
                data["imglink"]=$(this).val().trim();
            }
        })
        imglinkArry.push(data);//向数组中添加元素
        data={}; //重新赋值为空数组
    }

    //保存
    $.post('/sceAtlasinfo/savescenicImgurl', {'parmJson': JSON.stringify(imglinkArry)}, function (value) {
        if (value.status == 0 && value.msg == "ok") {
            $("#faceAndVideoBody").html("");
            layer.closeAll();
            myatlasinfo();
            layer.msg("操作成功！",{icon:1,time:2000});
        } else {
            layer.closeAll();
            if(value=="" || value==null){
                layer.alert("接口出现错误！", {icon: 2});
            }else {
                layer.alert(value.msg, {icon: 2});
            }
        }
    });

}

// //修改
// function question_edit() {
//
//     ComOpenWin(1,"农家乐图集", "auto","auto", $('#updateAtasinfobuildwin'), 1);
// }


//追加图片图集样式
var editimgurlArry = [];
function newVideoInfo(state,imgurlArry) {

    console.log("追加数组："+imgurlArry.length+","+imgurlArry);
    var bodylength=$("#faceAndVideoBody tr").length+1;
    if (bodylength > 30) {
        layer.alert("图集不能大于30张!",{icon:0});
        return;
    }
    var  html = "";
    var html_addbtn = "";
    if (state == 1){
        html_addbtn = '<button class="add_shipinbtn" type="button" onclick="newVideoInfo(2,editimgurlArry)">'+
            '<i class="icon-plus"></i>'+
            '</button>';
    }else {
        html_addbtn = "";
    }
    if (imgurlArry.length == 0){ //返回的 imglink 没有数据。
        html =
            '<tr class="advertising_cover'+bodylength+'" style="height:90px;">'+
            '<td style="width: 15%;padding-top:15px;vertical-align: top;">景区图集'+bodylength+'：</td>'+
            '<td>'+
            '<input type="text" class="id" style="display: none" value="0"> '+
            '<input type="text" class="business_encryptId_app" style="display: none" value="'+current_business_encryptId+'"> '+
            '<input type="text" class="arm_encryptId_app" style="display: none" value="'+current_sceinc_encryptId+'"> '+
            '<input type="text" placeholder="" class="url url_app url1'+bodylength+'">'+ //图片地址
            '<a class="a_upload" style="cursor:pointer;" id="url1'+bodylength+'">上传'+ '</a>'+
            html_addbtn+
            '</td>'+
            '</tr>';
        $("#faceAndVideoBody").append(html);
        var id = "#url1"+bodylength;
        picupload(id);
        html = "";
    }
    for (var i=0;i<imgurlArry.length;i++){
        html=
            '<tr class="advertising_cover'+Number(bodylength+i)+'" style="height:90px;">'+
            '<td style="width: 15%;padding-top:15px;vertical-align: top;">景区图集'+Number(bodylength+i)+'：</td>'+
            '<td>'+
            '<input type="text" class="id" style="display: none" value="'+imgurlArry[i].id+'"> '+ //masterid:1249
            '<input type="text" class="business_encryptId_app" style="display: none" value="'+imgurlArry[i].business_encryptId+'"> '+ //masterid:1249
            '<input type="text" class="farm_encryptId_app" style="display: none" value="'+imgurlArry[i].scenic_encryptId+'"> '+ //masterid:1249
            '<input type="text" placeholder="" class="url url_app url1'+Number(bodylength+i)+'" value="'+imgurlArry[i].imgurl+'">'+
            '<a class="a_upload" style="cursor:pointer;" id="url1'+Number(bodylength+i)+'">上传'+ '</a>' +
            html_addbtn+
            '</td>'+
            '</tr>';
        $("#faceAndVideoBody").append(html);
        var id = "#url1"+Number(bodylength+i);
        picupload(id);
    }

}



/***********************************-------娱乐项目------************************************************/
var entertain_sortfild = '';
var entertain_sortway = '';
$(function () {
    //排序
    $(".entertain_list_sort_tab").click(function(){
        entertain_sortfild = $(this).attr("value");
        if($(this).find("i").hasClass("icon_downs")) {
            $(this).find("i").removeClass("icon_downs");
            $(this).find("i").addClass("icon_ups");
            entertain_sortway = "asc";
        } else {
            $(this).find("i").removeClass("icon_ups");
            $(this).find("i").addClass("icon_downs");
            entertain_sortway = "desc";
        }
        //必须要，否则排序则不能调用该方法  使用该句，当点击排序，就同时点击了 第一页的按钮，自动调用分页的效果，
        ttname = "景区娱乐项目";
        $("#first_button").click();
    })

    //评价图片显示
    $(document).on("click", ".show_img",function(){
        var allvalue = $(this).attr("src").split(",");
        var str = "";
        for (var i = 0; i < allvalue.length; i++) {
            if (str == "") {
                str = allvalue[i];
            } else {
                str += "," + allvalue[i];
            }
        }
        var url = str.split(",");
        var prompt = '<div class="swiper-container">';
        prompt += "<div class='swiper-wrapper jilu_swiper'>";
        for (var i = 0; i < url.length; i++) {
            prompt += "<div class=\"swiper-slide\"><img style='max-width:480px;max-height:300px;' onclick='enlargeCoatchAttachment(\"" + url + "\",\"" + url[i] + "\")' src='" + url[i] + "'></div>";
        }
        prompt += "</div>";
        if (url.length > 1) {
            /*导航按钮*/
            prompt += "<div class=\"swiper-button-prev prev_swiper\"></div><div class=\"swiper-button-next next_swiper\"></div>";
        }
        prompt += "</div>";
        /*分页器*/
        prompt += "<div class=\"swiper-pagination\"></div>";

        var cancel = "<div class=\"linepopup_div\"></div>";
        cancel += "<div class=\"d_btn\">";
        cancel += "<div class=\"linepopup_button\">";
        cancel += "<a href=\"javascript:mclose()\" class=\"sure_btn1\">取消</a>";
        cancel += "</div>";
        cancel += "</div>";


        var confirm = "";
        var html = "<div class='linepopup1'>" + prompt + "</div>" + cancel
            + confirm;
        ComOpenWin(1, "图片", "auto", 'auto', html, 1);

        var mySwiper = new Swiper('.swiper-container', {
            pagination: {
                el: '.swiper-pagination',
                type: 'fraction'
            },
            navigation: {
                nextEl: '.swiper-button-next',
                prevEl: '.swiper-button-prev'
            }
        })
    });

})

//图片全屏显示
function enlargeCoatchAttachment(url, currentURL) {
    var url = url.split(",");
    var photos = new Array();
    for (var i = 0; i < url.length; i++) {
        photos.push({"alt": "图片" + (1 + i), "pid": "", "src": url[i], "thumb": ""});
    }
    var json = {"title": "附件图片", "id": "", "start": url.indexOf(currentURL), "data": photos};
    layer.photos({
        photos: json
        , anim: 5, //0-6的选择，指定弹出图片动画类型，默认随机（请注意，3.0之前的版本用shift参数）
        maxHeight: "80%",
        maxWidth: "80%",
        full: true
    });
}

//数据列表
function getbusinessEntertainment(){
    var field=$("#search_name").attr("value"); //搜索字段
    var pagesize = $("#selectPageSize1").text();
    var pageindex = $("#currentPage").text();
    var layLoad=layer.load(2);
    $("#my_entertain_list").empty();
    $.post('/sceEnter/getEntertainlist', {
        "pagesize": pagesize,
        "pageindex": pageindex,
        "starttime": "",
        "endtime": "",
        "searchkey": "",
        "searchval": "",
        "sortfild": entertain_sortfild,
        "sortway": entertain_sortway,
        "sceinc_encryptId": current_sceinc_encryptId
    }, function (value) {
        layer.close(layLoad);
        if(value.status==0 && value.msg == "ok"){
            var list=value.list;
            var pagecount=value.pagecount;
            var recordcount=value.recordcount;
            $("#totalSize").html(recordcount);
            $("#totalPage").html(pagecount);
            if(list.length==0){
                $("#my_entertain_list").prepend("<tr class=\"iframe_tr iframe_bg\"><td colspan=\"6\" style=\"width:1126px;text-align:center;\">暂无数据</td></tr>");
            }else{
                var htm="";
                for(var i=0;i<list.length;i++){
                    htm+="<tr>";
                    htm+="<td><input type=\"checkbox\" data="+list[i].id+"  class=\"checkbox\"></td>";
                    htm+="<td><span class='show_tips'>"+(list[i].enterName==null?"":list[i].enterName)+"</span></td>";
                    htm+="<td><span class='show_tips'>"+(list[i].enterIntr == null ? "" :list[i].enterIntr)+"</span></td>";

                    if(list[i].enterImg != "" && list[i].enterImg != null){
                        htm += "<td><a href='javascript:void(0)' class='show_img' src='" + list[i].enterImg + "'>查看</a></td>";
                    }else {
                        htm += "<td></td>";
                    }
                    htm+="<td><span class='show_tips'>"+list[i].createtime+"</span></td>";

                    htm+="<td class='td-manage'>";
                    htm += "<a href=\"javascript:void(0)\" onclick=\"question_entertainedit('"+list[i].id+"','"+list[i].scenic_encryptId+"')\">修改</a></div>";
                    htm += "<a href=\"javascript:void(0)\" onclick=\"question_entertaindel('"+list[i].id+"')\">删除</a></div>";
                    htm += "</td>";

                    htm+="</tr>";
                }
                $("#my_entertain_list").html(htm);

            }
        }else{
            if(value.msg==null||value.msg==""){
                layer.alert("接口出现错误！", {icon: 2})
            }else{
                layer.alert(value.msg, {icon: 2})
            }
        }
    })
}

//添加
function question_entertainadd() {

    $("#add_merchan_id").attr("value","0");

    var imgurlArry = new Array();
    $("#merchan_tr").html("");

    merchan_newVideoInfo(1,imgurlArry); //追加样式
    ComOpenWin(1,"新建", "auto","auto", $('#newmerchanbuildwin'), 1);
}

//修改
var ed_enterid = "";
var ed_enterName = "";
var ed_enterIntr = "";
function question_entertainedit(id,scenic_encryptId){

    var imgurlArry = new Array();
    $("#merchan_tr").html("");

    $("#add_merchan_id").attr("value",id);
    //查询最新数据
    var ii = layer.load(2);
    $.post('/sceEnter/getEntertainOne', {
        "scenic_encryptId":scenic_encryptId,
        "enterid": id,
    }, function (data) {
        layer.close(ii);
        if (data.status == 0 && data.msg == 'ok') {

            var list = data.list;
            if (list.length == 0) {
                imgurlArry = [];
                ed_enterid = id;
                ed_enterName = "";
                ed_enterIntr = "";
            }else {
                ed_enterid = list[0].id;
                ed_enterName = list[0].enterName;
                ed_enterIntr = list[0].enterIntr;
                imgurlArry = list[0].enterImg.split(",");
            }
            merchan_newVideoInfo(1,imgurlArry); //追加样式
            ComOpenWin(1,"修改", "auto","auto", $('#newmerchanbuildwin'), 1);

        } else {
            if(data.msg==null||data.msg==""){
                layer.alert("接口出现错误！", {icon: 2})
            }else{
                layer.alert(data.msg, {icon: 2})
            }
        }
    })


}

//保存，提交请求
function addEnterainSave() {

    var merchan_id = $("#add_merchan_id").attr("value");
    var merchanName = $("#merchanName").val().trim(); //项目名称
    var remarks = $("#remarks").val().trim(); //项目简介

    var imglinkArry = new Array(); //小类APP广告1,或者2
    var data={};

    var bodylength=$("#merchan_tr tr").length;
    for (var k=1;k<=bodylength-2;k++){
        var sx = ".advertising_cover"+k
        $(""+sx+" input[type='text']").each(function (i,item) {
            if(i == 0){
                data["id"]=$(this).attr("value");
            }else if(i == 1){
                data["imglink"]=$(this).val().trim();
            }
        })
        if(data != "{}"){
            imglinkArry.push(data);//向数组中添加元素
        }
        data={}; //重新赋值为空数组
    }
    console.log("imglinkArry:"+imglinkArry);

    if(merchanName == "" || merchanName == null){
        layer.alert("项目名称不能为空！",{icon:2,time:2000});
    }else {

        var ii = layer.load(2);
        $.post('/sceEnter/updateEntertain', {
            "business_encryptId":current_business_encryptId,
            "scenic_encryptId":current_sceinc_encryptId,
            "enterid": merchan_id,
            "enterName": merchanName,
            "enterIntr": remarks,
            "parmJson": JSON.stringify(imglinkArry)
        }, function (data) {
            layer.close(ii);
            if (data.status == 0 && data.msg == 'ok') {
                layer.msg("操作成功！",{time:2000,icon:1});
                mclose();
                ttname = "景区娱乐项目";
                $("#first_button").click();

            } else {
                if(data.msg==null||data.msg==""){
                    layer.alert("接口出现错误！", {icon: 2})
                }else{
                    layer.alert(data.msg, {icon: 2})
                }
            }
        })
    }
}


//全选批量删除
function entertaindelAll() {
    var tidsArry = new Array();
    $('#my_entertain_list input[class="checkbox"]:checked').each(function(){
        tidsArry.push($(this).attr("data"));//向数组中添加元素
    });
    if (tidsArry.length == 0){
        layer.alert("请至少选择一个要删除内容！",{icon:0});
    }else {
        layer.confirm('确认要删除吗？', function(index) {
            var ii = layer.load(2);
            $.post('/sceEnter/delsceinEnter', {"enterid": tidsArry.join(",")}, function (data) {
                layer.close(ii);
                if (data.status == 0 && data.msg == 'ok') {
                    layer.msg("操作成功！",{time:2000,icon:1});
                    ttname = "景区娱乐项目";
                    $("#first_button").click();
                    mclose();
                } else {
                    if(data.msg==null||data.msg==""){
                        layer.alert("接口出现错误！", {icon: 2})
                    }else{
                        layer.alert(data.msg, {icon: 2})
                    }
                }
            })
        });
    }
}

//单个删除
function question_entertaindel(id) {
    if(id != ""){
        layer.confirm('确认要删除吗？', function(index) {
            var ii = layer.load(2);
            $.post('/sceEnter/delsceinEnter', {"enterid": id}, function (data) {
                layer.close(ii);
                if (data.status == 0 && data.msg == 'ok') {
                    layer.msg("操作成功！",{time:2000,icon:1});
                    ttname = "景区娱乐项目";
                    $("#first_button").click();
                    mclose();
                } else {
                    if(data.msg==null||data.msg==""){
                        layer.alert("接口出现错误！", {icon: 2})
                    }else{
                        layer.alert(data.msg, {icon: 2})
                    }
                }
            })
        });
    }else {
        layer.alert("room_id不能为空！",{icon:2,time:2000});
    }
}


//追加娱乐项目图片样式
var merchaneditimgurlArry = [];
function merchan_newVideoInfo(state,imgurlArry) {

    var bodylength=$("#merchan_tr tr").length+1;
    if(bodylength != "1"){
        bodylength = bodylength-2;
    }
    if (bodylength > 5) {
        layer.alert("娱乐项目不能大于5张!",{icon:0});
        return;
    }
    var  html = "";
    var html_addbtn = "";
    var table_tr = ""; //其他字段
    if (state == 1){
        html_addbtn = '<button class="add_shipinbtn" style="margin-top: 162px;" type="button" onclick="merchan_newVideoInfo(2,merchaneditimgurlArry)">'+
            '<i class="icon-plus"></i>'+
            '</button>';

        table_tr += '<tr class="tr_s">';
        table_tr += '<td class="status_s">项目名称：</td>';
        table_tr += '<td><input type="text" id="merchanName" style="width: 40%" value=""></td>';
        table_tr += '</tr>';
        table_tr += '<tr class="tr_s">';
        table_tr += '<td class="status_s">项目简介：</td>';
        table_tr += '<td><textarea id="remarks" class="td_textarea" value=""></textarea></td>';
        table_tr += '</tr>';
    }else {
        html_addbtn = "";
        table_tr = "";
    }
    if (imgurlArry.length == 0){ //返回的 imglink 没有数据。
        html = table_tr +
            '<tr class="advertising_cover'+Number(bodylength)+'" style="height:100px;">'+
            '<td style="width: 20%;padding-top:15px;vertical-align: top;">展示图'+Number(bodylength)+'：</td>'+
            '<td>'+
            '<input type="text" class="id" style="display: none" value="0"> '+
            '<input type="text" class="url url_app url1'+Number(bodylength)+'">'+ //图片地址
            '<a class="a_upload" style="cursor:pointer;" id="url1'+Number(bodylength)+'">上传'+ '</a>'+
            html_addbtn+
            '</td>'+
            '</tr>';
        $("#merchan_tr").append(html);
        var id = "#url1"+bodylength;
        picupload(id);
        html = "";
    }
    var edtable_tr = "";
    for (var i=0;i<imgurlArry.length;i++){
        if(i==0){
            edtable_tr += '<tr class="tr_s">';
            edtable_tr += '<td class="status_s">项目名称：</td>';
            edtable_tr += '<td><input type="text" id="merchanName" style="width: 40%" value="'+ed_enterName+'"></td>';
            edtable_tr += '</tr>';
            edtable_tr += '<tr class="tr_s">';
            edtable_tr += '<td class="status_s">项目简介：</td>';
            edtable_tr += '<td><textarea id="remarks" class="td_textarea">'+ed_enterIntr+'</textarea></td>';
            edtable_tr += '</tr>';
        }else {
            edtable_tr = "";
        }
        html= edtable_tr +
            '<tr class="advertising_cover'+Number(bodylength+i)+'" style="height:100px;">'+
            '<td style="width: 20%;padding-top:15px;vertical-align: top;">展示图'+Number(bodylength+i)+'：</td>'+
            '<td>'+
            '<input type="text" class="id" style="display: none" value="'+ed_enterid+'"> '+ //masterid:1249
            '<input type="text" class="url url_app url1'+Number(bodylength+i)+'" value="'+imgurlArry[i]+'">'+
            '<a class="a_upload" style="cursor:pointer;" id="url1'+Number(bodylength+i)+'">上传'+ '</a>' +
            html_addbtn+
            '</td>'+
            '</tr>';
        $("#merchan_tr").append(html);
        var id = "#url1"+Number(bodylength+i);
        picupload(id);
    }

}



/***********************************-------评论项目------************************************************/
var discuss_sortfild = '';
var discuss_sortway = '';
$(function () {
    //排序
    $(".discuss_list_sort_tab").click(function(){
        discuss_sortfild = $(this).attr("value");
        if($(this).find("i").hasClass("icon_downs")) {
            $(this).find("i").removeClass("icon_downs");
            $(this).find("i").addClass("icon_ups");
            discuss_sortway = "asc";
        } else {
            $(this).find("i").removeClass("icon_ups");
            $(this).find("i").addClass("icon_downs");
            discuss_sortway = "desc";
        }
        //必须要，否则排序则不能调用该方法  使用该句，当点击排序，就同时点击了 第一页的按钮，自动调用分页的效果，
        ttname = "景区评论信息";
        $("#first_button").click();
    })
})

//数据列表
function getbusinessDiscussinfo() {

    var field=$("#search_name").attr("value"); //搜索字段
    var pagesize = $("#selectPageSize1").text();
    var pageindex = $("#currentPage").text();
    var layLoad=layer.load(2);
    $("#my_discuss_list").empty();
    $.post('/scediscuss/getSceincdiscusslist', {
        "pagesize": pagesize,
        "pageindex": pageindex,
        "starttime": "",
        "endtime": "",
        "searchkey": "",
        "searchval": "",
        "sortfild": discuss_sortfild,
        "sortway": discuss_sortway,
        "sceinc_encryptId": current_sceinc_encryptId,
        "user_encryptId":""
    }, function (value) {
        layer.close(layLoad);
        if(value.status==0 && value.msg == "ok"){
            var list=value.list;
            var pagecount=value.pagecount;
            var recordcount=value.recordcount;
            $("#totalSize").html(recordcount);
            $("#totalPage").html(pagecount);
            if(list.length==0){
                $("#my_discuss_list").prepend("<tr class=\"iframe_tr iframe_bg\"><td colspan=\"8\" style=\"width:1126px;text-align:center;\">暂无数据</td></tr>");
            }else{
                var htm="";
                for(var i=0;i<list.length;i++){
                    htm+="<tr>";
                    htm+="<td><span class='show_tips'>"+(list[i].scenicTypeName==null?"":list[i].scenicTypeName)+"</span></td>";
                    htm+="<td><span class='show_tips'>"+(list[i].CompanyName == null ? "" :list[i].CompanyName)+"</span></td>";
                    htm+="<td><span class='show_tips'>"+(list[i].username == null ? "" :list[i].username)+"</span></td>";
                    htm+="<td><span class='show_tips'>"+(list[i].score == null ? "" :list[i].score+"分")+"</span></td>";
                    htm+="<td><span class='show_tips'>"+(list[i].context == null ? "" :list[i].context)+"</span></td>";
                    htm+="<td><span class='show_tips'>"+(list[i].impression == null ? "" :list[i].impression)+"</span></td>";

                    if(list[i].discus_img != "" && list[i].discus_img != null){
                        htm += "<td><a href='javascript:void(0)' class='show_img' src='" + list[i].discus_img + "'>查看</a></td>";
                    }else {
                        htm += "<td></td>";
                    }
                    htm+="<td><span class='show_tips'>"+list[i].createtime+"</span></td>";
                    htm+="</tr>";
                }
                $("#my_discuss_list").html(htm);

            }
        }else{
            if(value.msg==null||value.msg==""){
                layer.alert("接口出现错误！", {icon: 2})
            }else{
                layer.alert(value.msg, {icon: 2})
            }
        }
    })
}



/***********************************-------收藏项目------************************************************/
var collect_sortfild = '';
var collect_sortway = '';
$(function () {
    //排序
    $(".collect_list_sort_tab").click(function(){
        collect_sortfild = $(this).attr("value");
        if($(this).find("i").hasClass("icon_downs")) {
            $(this).find("i").removeClass("icon_downs");
            $(this).find("i").addClass("icon_ups");
            collect_sortway = "asc";
        } else {
            $(this).find("i").removeClass("icon_ups");
            $(this).find("i").addClass("icon_downs");
            collect_sortway = "desc";
        }
        //必须要，否则排序则不能调用该方法  使用该句，当点击排序，就同时点击了 第一页的按钮，自动调用分页的效果，
        ttname = "农家收藏信息";
        $("#first_button").click();
    })

})

//数据列表
function getbusinessCollectinfo() {
    var field=$("#search_name").attr("value"); //搜索字段
    var pagesize = $("#selectPageSize1").text();
    var pageindex = $("#currentPage").text();
    var layLoad=layer.load(2);
    $("#my_collect_list").html("");
    $("#my_collect_list").empty();
    $.post('/scecollect/getSceinccollectlist', {
        "pagesize": pagesize,
        "pageindex": pageindex,
        "starttime": "",
        "endtime": "",
        "searchkey": "",
        "searchval": "",
        "sortfild": collect_sortfild,
        "sortway": collect_sortway,
        "sceinc_encryptId": current_sceinc_encryptId,
        "user_encryptId":""

    }, function (value) {
        layer.close(layLoad);
        if(value.status==0 && value.msg == "ok"){
            var list=value.list;
            var pagecount=value.pagecount;
            var recordcount=value.recordcount;
            $("#totalSize").html(recordcount);
            $("#totalPage").html(pagecount);
            if(list.length==0){
                $("#my_collect_list").prepend("<tr class=\"iframe_tr iframe_bg\"><td colspan=\"4\" style=\"width:1126px;text-align:center;\">暂无数据</td></tr>");
            }else{
                var htm="";
                for(var i=0;i<list.length;i++){
                    htm+="<tr>";
                    htm+="<td><span class='show_tips'>"+(list[i].scceincTypeName==null?"":list[i].scceincTypeName)+"</span></td>";
                    htm+="<td><span class='show_tips'>"+(list[i].CompanyName == null ? "" :list[i].CompanyName)+"</span></td>";
                    htm+="<td><span class='show_tips'>"+(list[i].username == null ? "" :list[i].username)+"</span></td>";
                    htm+="<td><span class='show_tips'>"+list[i].createtime+"</span></td>";
                    htm+="</tr>";
                }
                $("#my_collect_list").html(htm);

            }
        }else{
            if(value.msg==null||value.msg==""){
                layer.alert("接口出现错误！", {icon: 2})
            }else{
                layer.alert(value.msg, {icon: 2})
            }
        }
    })
}



/***********************************-------定制信息------************************************************/

var pick_sortfild = '';
var pick_sortway = '';
$(function () {
    //排序
    $(".pick_list_sort_tab").click(function(){
        pick_sortfild = $(this).attr("value");
        if($(this).find("i").hasClass("icon_downs")) {
            $(this).find("i").removeClass("icon_downs");
            $(this).find("i").addClass("icon_ups");
            pick_sortway = "asc";
        } else {
            $(this).find("i").removeClass("icon_ups");
            $(this).find("i").addClass("icon_downs");
            pick_sortway = "desc";
        }
        //必须要，否则排序则不能调用该方法  使用该句，当点击排序，就同时点击了 第一页的按钮，自动调用分页的效果，
        ttname = "景区定制信息";
        $("#first_button").click();
    })

    //下拉框
    $(document).on('click', ".my_select_ul li", function () {
        $(this).parent().siblings("div").find("span").html($(this).text());
        $(this).parent().siblings("div").find("span").attr("value", $(this).attr("value"));
        if ($(this).parent().siblings("div").find("span").hasClass("type_select")) {
            if ($(this).text() == "全部") {
                $(".type_select").text("挑选类型");
            }
        } else if ($(this).parent().siblings("div").find("span").hasClass("category_select")) {
            if ($(this).text() == "全部") {
                $(".category_select").text("定制类别");
            }
        } else if ($(this).parent().siblings("div").find("span").hasClass("datasource_select")) {
            if ($(this).text() == "全部") {
                $(".datasource_select").text("数据来源");
            }
        }else if ($(this).parent().siblings("div").find("span").hasClass("applicant_select")) {
            if ($(this).text() == "全部") {
                $(".applicant_select").text("申请人");
            }
        }
        //获取数据
        ttname = "景区定制信息";
        $("#first_button").click();
    })
})

//获取数据列表
function getbusinessCustominfo() {
    var pagesize = $("#selectPageSize1").text();
    var pageindex = $("#currentPage").text();
    var type = $("#type_select_name").attr("value");//挑选类型
    var category = $("#category_select_name").attr("value");//定制类别
    var datasource = $("#datasource_select_name").attr("value");//数据来源
    var applicant = $("#applicant_select_name").attr("value");//申请人
    var layLoad=layer.load(2);
    $("#my_pick_list").empty();
    $.post('/custom/getcustolist', {
        "pagesize": pagesize,
        "pageindex": pageindex,
        "starttime": starttime,
        "endtime": endtime,
        "searchval": "",
        "searchkey": "",
        "sortfild": pick_sortfild,
        "sortway": pick_sortway,
        "type": type,
        "category": category,
        "datasource": datasource,
        "applicant": "",
        "user_encryptId":current_sceinc_encryptId
    }, function (value) {
        layer.close(layLoad);
        if(value.status==0 && value.msg == "ok"){
            var list=value.list;
            var applylist = value.applylist;
            var pagecount=value.pagecount;
            var recordcount=value.recordcount;
            $("#totalSize").html(recordcount);
            $("#totalPage").html(pagecount);


            if(list.length==0){
                $("#my_pick_list").prepend("<tr class=\"iframe_tr iframe_bg\"><td colspan=\"13\" style=\"width:1126px;text-align:center;\">暂无数据</td></tr>");
            }else{
                var htm="";
                for(var i=0;i<list.length;i++){
                    htm+="<tr>";
                    htm+="<td><span class='show_tips'>"+(list[i].type==null?"":gettypeName(list[i].type))+"</span></td>";
                    // htm+="<td><span class='show_tips'>"+(list[i].applicatName == null ? "" :list[i].applicatName)+"</span></td>";
                    htm+="<td><span class='show_tips'>"+(list[i].user_name == null ? "" :list[i].user_name)+"</span></td>";
                    htm+="<td><span class='show_tips'>"+(list[i].user_realName == null ? "" :list[i].user_realName)+"</span></td>";
                    htm+="<td><span class='show_tips'>"+(list[i].tel == null ? "" :list[i].tel)+"</span></td>";
                    htm+="<td><span class='show_tips'>"+(list[i].category == null ? "" :getCategoryName(list[i].category))+"</span></td>";
                    htm+="<td><span class='show_tips'>"+(list[i].dataSources == null ? "" :getdataSources(list[i].dataSources))+"</span></td>";
                    htm+="<td><span class='show_tips'>"+(list[i].CompanyName == null ? "" :list[i].CompanyName)+"</span></td>";
                    htm+="<td><span class='show_tips'>"+(list[i].createtime == null ? "" :list[i].createtime)+"</span></td>";

                    htm +="<td class='td-manage'>";
                    htm += "<a href=\"javascript:void(0)\" onclick=\"question_Customdetails('"+list[i].user_tel+"','"+list[i].user_id+"','"+list[i].cust_encryptId+"','"+list[i].user_encryptId+"')\">详情</a></div>";
                    htm += "<a href=\"javascript:void(0)\" onclick=\"question_Customdel('"+list[i].cust_encryptId+"')\">删除</a></div>";
                    htm += "</td>";

                    htm+="</tr>";
                }
                $("#my_pick_list").html(htm);

            }
        }else{
            if(value.msg==null||value.msg==""){
                layer.alert("接口出现错误！", {icon: 2})
            }else{
                layer.alert(value.msg, {icon: 2})
            }
        }
    })
}

//挑选类型
function gettypeName(type) {
    if (type != ""){
        if(type == "1"){
            return "挑选农家"
        }else if(type == "2"){
            return "挑选景区"
        }
        return "";
    }
    return "";
}
//定制类型
function getCategoryName(category) {
    if (category != ""){
        if(category == "1"){
            return "私人定制"
        }else if(category == "2"){
            return "团队定制"
        }
        return "";
    }
    return "";
}
//数据来源
function getdataSources(dataSources) {
    if (dataSources != ""){
        if(dataSources == "0"){
            return "管理系统"
        }else if(dataSources == "1"){
            return "前端官网"
        }
        return "";
    }
    return "";
}


//点击详情 - 跳转商家详情信息页面（应判断用户提交的是挑选农家，还旅游景区）
function question_Customdetails(user_tel,user_id,cust_encryptId,user_encryptId){
    setcookie("tel",user_tel,1,"/");//注册时，用户填写的电话号码
    setcookie("user_id",user_id,1,"/"); //用户id
    setcookie("user_encryptid",user_encryptId,1,"/"); //用户加密id
    setcookie("cust_encryptid",cust_encryptId,1,"/"); //定制游加密id
    var size = "pick-farm/pick_info_new.html".length;
    window.parent.addTab_father("定制详情", "pick-farm/pick_info_new.html", size);
}

//删除
function question_Customdel(id) {
    layer.confirm('确认要删除吗？', function(index) {
        var ii = layer.load(2);
        $.post('/custom/delcustom', {"custEncryptid": id}, function (data) {
            layer.close(ii);
            if (data.status == 0 && data.msg == 'ok') {
                layer.msg("操作成功！",{time:2000,icon:1});
                ttname = "景区定制信息";
                $("#first_button").click();
            } else {
                if(data.msg==null||data.msg==""){
                    layer.alert("接口出现错误！", {icon: 2})
                }else{
                    layer.alert(data.msg, {icon: 2})
                }
            }
        })
    });
}